package cn.crsc.openlookeng.domain;


import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class PageRequest {
    private static final long serialVersionUID = 1232825578694716871L;
    private final int page;
    private final int size;

    protected PageRequest(int page, int size) {
        if (page < 0) {
            throw new IllegalArgumentException("Page index must not be less than zero!");
        } else if (size < 1) {
            throw new IllegalArgumentException("Page size must not be less than one!");
        } else {
            this.page = page;
            this.size = size;
        }
    }


    public static PageRequest of(int page, int size) {
        return new PageRequest(page, size);
    }



}